<div id="content">
	<div class="row s_page_title" *ngIf="pageType ==='new'">
		<sa-big-breadcrumbs [items]="['供应链管理','品质管理','新增'+name]" icon="fa fa-cogs"
			class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<div class="row s_page_title" *ngIf="pageType ==='updata'">
		<sa-big-breadcrumbs [items]="['供应链管理','品质管理','编辑'+name]" icon="fa fa-cogs"
			class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<div class="s_page_wrap">
		<div class="page-header">
			<h1 class="page_detail_title">{{page_title}}{{name}}</h1>
		</div>
		<div class="row" style="margin-top:5px;">
			<div class="col-xs-12">
				<form name="purchaseForm" id="purchaseForm" class="form-horizontal" (ngSubmit)="onSubmit()"
					novalidate="novalidate" [saBootstrapValidator]="validatorOptions">
					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right">检验日期<sup>*</sup></label>
						<div class="col-sm-10">
							<div class="clearfix">
								<input *ngIf="pageType ==='new'" class="form-control s_selected_time" name="checkDate"
									type="text" [(ngModel)]='pageFormData.checkDate' id="datetimepicker1"
									autocomplete="off" placeholder="选择检验日期" />
								<input *ngIf="pageType ==='updata'" class="form-control s_selected_time"
									name="checkDate" type="text" [(ngModel)]='pageFormData.checkDate'
									id="datetimepicker1" autocomplete="off" placeholder="选择检验日期" disabled />
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right">订单号</label>
						<div class="col-sm-10">
							<div class="clearfix cancle">
								<input class="form-control" name="orderNumber" [(ngModel)]='pageFormData.orderNumber'
									type="text" placeholder="订单号" />
								<div class="s_del_icon" (click)='delKey("orderNumber")'>x</div>
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right">物料编码</label>
						<div class="col-sm-10">
							<div class="clearfix cancle">
								<input class="form-control" name="materialCode" [(ngModel)]='pageFormData.materialCode'
									type="text" placeholder="物料编码" />
								<div class="s_del_icon" (click)='delKey("materialCode")'>x</div>
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right">产品名称<sup>*</sup></label>
						<div class="col-sm-10">
							<div class="clearfix cancle">
								<input class="form-control" name="productName" [(ngModel)]='pageFormData.productName'
									type="text" placeholder="产品名称" />
								<div class="s_del_icon" (click)='delKey("productName")'>x</div>
							</div>
						</div>
					</div>

					<div class="form-group" *ngIf="isAddHostAssembly">
						<label class="control-label col-sm-1 no-padding-right">通道数<sup>*</sup></label>
						<div class="col-sm-10">
							<div class="clearfix cancle">
								<input class="form-control" name="sensor" [(ngModel)]='pageFormData.sensor' type="text"
									placeholder="通道数" />
								<div class="s_del_icon" (click)='delKey("sensor")'>x</div>
							</div>
						</div>
					</div>

					<div class="form-group" *ngIf="isAddHostAssembly">
						<label class="control-label col-sm-1 no-padding-right">物联卡类型<sup>*</sup></label>
						<div class="col-sm-10">
							<div class="clearfix">
								<select class="form-control" name="iotCardType" [(ngModel)]="pageFormData.iotCardType"
									(change)="typeChange($event.target.value)" style="width: 100%">
									<option value="">请选择</option>
									<option *ngFor="let item of typeList" [value]='item.value'>{{item.label}}</option>
								</select>
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right">订单数量<sup>*</sup></label>
						<div class="col-sm-10">
							<div class="clearfix cancle">
								<input class="form-control" name="orderNum" maxlength="9"
									onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
									[(ngModel)]='pageFormData.orderNum' type="text" placeholder="订单数量" />
								<div class="s_del_icon" (click)='delKey("orderNum")'>x</div>
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right">检测数量<sup>*</sup></label>
						<div class="col-sm-10">
							<div class="clearfix cancle">
								<input class="form-control" name="checkNum" maxlength="9"
									onkeyup="value=value.replace(/[^\d]/g,'')" [(ngModel)]='pageFormData.checkNum'
									type="text" placeholder="检测数量" />
								<div class="s_del_icon" (click)='delKey("checkNum")'>x</div>
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right">不良数量</label>
						<div class="col-sm-10">
							<div class="clearfix cancle">
								<input class="form-control" name="badNum" [(ngModel)]='pageFormData.badNum' type="text"
									placeholder="不良数量" disabled />
							</div>
						</div>
					</div>

					<div class="form-group">
						<label class="control-label col-sm-1 no-padding-right" for="sourceUrl">不良明细</label>
						<div class="col-sm-10">
							<div class="clearfix">
								<a class="uploadBtn btn-primary" (click)="selectBadReason(badReasonModal)">选择不良原因</a>
								<div class="bad-reason">
									<div *ngFor="let item of pageFormData.badInfoList; let i = index"
										[attr.data-index]="i" class="form-group" style="margin-top: 10px;">
										<div class="control-label col-sm-2 no-padding-left">{{item.name}}</div>
										<div class="col-xs-2">
											<div class="clearfix numWrap">
												<span class="reduce"><i (click)="reduceNum(item)" class="fa fa-minus"
														aria-hidden="true"></i></span>
												<!-- 小的数量框 -->
												<input class="form-control" autocomplete="off" name="sensorAmount"
													maxlength="9" type="text" placeholder="数量"
													(change)="numChange($event.target.value,item)" [value]="item.count"
													onkeyup="value=value.replace(/[^\d]/g,'')" />
												<span class="add"><i (click)="addNum(item)" class="fa fa-plus"
														aria-hidden="true"></i></span>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="center">
						<button type="submit" class="btn btn-primary" *ngIf='page_title === "新增"'
							aria-disabled="disabled">添加</button>
						<button type="submit" class="btn btn-primary" *ngIf='page_title === "编辑"'>保存</button>
						<button type="button" (click)='goBack()' class="btn default">返回</button>
					</div>
				</form>
				<div class="hr hr-dotted"></div>
			</div>
		</div>
	</div>
</div>

<!-- 选择不良原因名称   弹窗-->
<section bsModal #badReasonModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
	aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg" style="width: 800px;margin-top:70px">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" (click)="modalClose(badReasonModal)" aria-label="Close"><span
						aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">选择不良原因名称</h4>
			</div>
			<div class="modal-body">
				<div class="badReason-search">
					<div class="right top-search" style="margin-right: 20px;">
						<input type="text" (change)="keywordSearch()" class="search-input" id="keywordSearch"
							placeholder="输入关键字检索">
						<span class="top-search-box">
							<button class="top-search-btn" type="button" (click)="keywordSearch()"> <i
									class="fa fa-search"></i></button>
						</span>
					</div>
				</div>

				<div class="badReason-items">
					<label *ngFor="let item of badReasonData; let i = index" [attr.data-index]="i"
						class="badReason-item checkbox-inline" [ngClass]="{badReasonItemActive:item.checked}">
						<input type="checkbox" class="checkbox s_checkbox_input loadometer" [(ngModel)]="item.checked">
						<span class="item-name">{{item.name}}</span>
					</label>
				</div>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" (click)="modalClose(badReasonModal)">取消</button>
				<button type="button" class="btn btn-primary" (click)="badReasonSubmit(badReasonModal)">确认</button>
			</div>
		</div>
	</div>
</section>
<!-- 选择不良原因名称 弹窗end-->